This is an Rmarkdown document. I can type whatever I want.
this is bold this is italic
Use setting button next to the Knit to set preview
Command opt i -> short cut for code
library(viridis)
suppressPackageStartupMessages(library(tidyverse))
library(ggplot2)
glimpse(storms)
## Observations: 10,010
## Variables: 13
## $ name <chr> "Amy", "Amy", "Amy", "Amy", "Amy", "Amy", "Amy", "...
## $ year <dbl> 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 19...
## $ month <dbl> 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,...
## $ day <int> 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30...
## $ hour <dbl> 0, 6, 12, 18, 0, 6, 12, 18, 0, 6, 12, 18, 0, 6, 12...
## $ lat <dbl> 27.5, 28.5, 29.5, 30.5, 31.5, 32.4, 33.3, 34.0, 34...
## $ long <dbl> -79.0, -79.0, -79.0, -79.0, -78.8, -78.7, -78.0, -...
## $ status <chr> "tropical depression", "tropical depression", "tro...
## $ category <ord> -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, ...
## $ wind <int> 25, 25, 25, 25, 25, 25, 25, 30, 35, 40, 45, 50, 50...
## $ pressure <int> 1013, 1013, 1013, 1013, 1012, 1012, 1011, 1006, 10...
## $ ts_diameter <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
## $ hu_diameter <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
ggplot(data=storms)+
geom_jitter(aes(x=as.factor(month),y=pressure, fill = wind), pch=21, alpha=.05)+
scale_fill_viridis_c()+
theme_bw()+
labs(title= "Hurricane", subtitle= "with Max Wind", x="month")
Fill the point depending on wind speed
Echo = False not show the code CANT download package in Rmarkdown
Writing out equations in Rmarkdown:
If you want to write an equation, you put $ on either side of it.
\(\sum_{i=y}^n x_i\)
library(knitr)
kable(head(storms), caption = "Table using kable")
| name | year | month | day | hour | lat | long | status | category | wind | pressure | ts_diameter | hu_diameter |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Amy | 1975 | 6 | 27 | 0 | 27.5 | -79.0 | tropical depression | -1 | 25 | 1013 | NA | NA |
| Amy | 1975 | 6 | 27 | 6 | 28.5 | -79.0 | tropical depression | -1 | 25 | 1013 | NA | NA |
| Amy | 1975 | 6 | 27 | 12 | 29.5 | -79.0 | tropical depression | -1 | 25 | 1013 | NA | NA |
| Amy | 1975 | 6 | 27 | 18 | 30.5 | -79.0 | tropical depression | -1 | 25 | 1013 | NA | NA |
| Amy | 1975 | 6 | 28 | 0 | 31.5 | -78.8 | tropical depression | -1 | 25 | 1012 | NA | NA |
| Amy | 1975 | 6 | 28 | 6 | 32.4 | -78.7 | tropical depression | -1 | 25 | 1012 | NA | NA |
htmlTable::htmlTable(head(storms))
| name | year | month | day | hour | lat | long | status | category | wind | pressure | ts_diameter | hu_diameter | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Amy | 1975 | 6 | 27 | 0 | 27.5 | -79 | tropical depression | -1 | 25 | 1013 | ||
| 2 | Amy | 1975 | 6 | 27 | 6 | 28.5 | -79 | tropical depression | -1 | 25 | 1013 | ||
| 3 | Amy | 1975 | 6 | 27 | 12 | 29.5 | -79 | tropical depression | -1 | 25 | 1013 | ||
| 4 | Amy | 1975 | 6 | 27 | 18 | 30.5 | -79 | tropical depression | -1 | 25 | 1013 | ||
| 5 | Amy | 1975 | 6 | 28 | 0 | 31.5 | -78.8 | tropical depression | -1 | 25 | 1012 | ||
| 6 | Amy | 1975 | 6 | 28 | 6 | 32.4 | -78.7 | tropical depression | -1 | 25 | 1012 |
library(DT)
## Warning: package 'DT' was built under R version 3.4.4
#make an interactive table
DT::datatable(storms)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
ggplotly(
ggplot(data=storms)+
geom_jitter(aes(x=as.factor(month),y=pressure, fill = wind), pch=21, alpha=.05)+
scale_fill_viridis_c()+
theme_bw()+
labs(title= "Hurricane", subtitle= "with Max Wind", x="month")
)
## Warning in L$marker$color[idx] <- aes2plotly(data, params, "fill")[idx]:
## number of items to replace is not a multiple of replacement length